package org.example.demo2.config;

import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @ClassName RabbitmqConfig
 * @Description 消息队列工具类
 * @Author Kx
 * @Date 2025/10/12 20:02
 * @Version 1.0
 */
@Configuration
public class RabbitmqConfig {
    /**
     * 定义点赞交换机
    */
    public static final String EXCHANGE_NAME = "like.change";

    /**
     * 定义点赞队列
    */
    public static final String QUEUE_NAME = "like.queue";

    /**
     * 定义路由key
    */
    public static final String ROUTING_KEY = "like.key";

    /**
     * 替换默认的SimpleMessageConverter序列化器
     */
    @Bean
    public MessageConverter messageConverter() {
        return new Jackson2JsonMessageConverter();
    }
}
